import React from 'react';
import { inject, observer } from 'mobx-react';
import { Button } from 'antd';
import { WeaRightMenu, WeaTop, WeaNewScroll, WeaLocaleProvider } from "ecCom";
import GovernImport from './governImport';
const getLabel = WeaLocaleProvider.getLabel;
@inject('importStore')
@observer
class Import extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        }
    }

    componentDidMount(){
        const { importStore } = this.props;
        const { type, categoryId } = this.props.location.query;
        const { initDatas, } = importStore;
        initDatas({ type, categoryId });
    }

    render() {
        const title = getLabel(389701, "督办事项导入");
        return (
            <div>
                <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@jr1t4m`} datas={this.getRightMenu()}  >
                    <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@ag204s`}
                        title={title}
                        icon={<i className='icon-coms-government' />}
                        iconBgcolor='#f14a2d'
                        buttons={this.getTopButtons()}
                        buttonSpace={10}
                        showDropIcon={true}
                        dropMenuDatas={this.getRightMenu()}
                        onDropMenuClick={this.onRightMenuClick}
                    >
                        <div className="govern-import-content">
                            <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@3w4t24`} scrollId='govern-content-main-scroll' height='100%'>
                                <div>
                                    <GovernImport ecId={`${this && this.props && this.props.ecId || ''}_GovernImport@evzcvm`} />
                                </div>
                            </WeaNewScroll>
                        </div>
                    </WeaTop>
                </WeaRightMenu>
            </div>
        )
    }

    getTopButtons = () => {
        const { doImport } = this.props.importStore;
        let btnArr = [];
        btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@peegxo@submit`} type="primary" onClick={() => doImport()}>{getLabel(615,"提交")}</Button>)
        return btnArr;
    }

    getRightMenu() {
        const { doImport } = this.props.importStore;
        let btnArr = [];
        btnArr.push({
            key: '1',
            icon: <i className={"icon-coms-Approval"} />,
            content: getLabel(615,"提交"),
            onClick: (key) => { doImport() }
        });
        return btnArr;
    }
}
export default Import;
